//
//  AppDelegate.swift
//  FruitJuice
//
//  Created by Rae on 2023/12/15.
//

import UIKit
@_exported import Stevia
@_exported import KakaJSON
@_exported import IQKeyboardManager

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        IQKeyboardManager.shared().isEnabled = true
        initializeWindow()
        return true
    }


    private func initializeWindow(){
        
        if let _ = UserDefaults.standard.object(forKey: "InApp") {
            if UserDefaults.standard.object(forKey: "UserInfo") != nil{
                let str = GetInfo(key: "UserInfo") as! NSDictionary
                let jsonData = InfoUtil.initInfo.deserialize(from: str)
                USEINFOMODEL = jsonData!
                self.window?.rootViewController = FJNavViewController(rootViewController: FJHomeViewController())
            }else
            {
                self.window?.rootViewController = FJNavViewController(rootViewController: FJWelcomeViewController())
            }
        }else{
            self.window?.rootViewController = FJGuidanceViewController()
        }
        
        self.window?.makeKeyAndVisible()
    }
}

